package com.techwells.heartfelt.viewobject;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

/**
 * 基本视图类
 * 
 * @author 马蹄声
 * @version 1.0
 */
@SuppressWarnings("serial")
public class HeartfeltBaseViewObject<V extends HeartfeltBaseViewObject<V>>
    extends BaseViewObject<V> {
    
    private Long vid;     // id of view object
    private String code;
    
    public Long getVid() {
        return vid;
    }

    public void setVid(Long vid) {
        this.vid = vid;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }
    
    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString( this, 
                ToStringStyle.MULTI_LINE_STYLE );
    }
    
    @SuppressWarnings("unchecked")
    @Override
    final public boolean equals( Object object ) {
        boolean b = false;
        if( object == null ) {
            b = false;
        }else if( object == this ) {
            b = true;
        }else if( object.getClass() == this.viewObjectClass ) {
            b = equals( ( V )object );
        }
        return b;
    }
    
    public boolean equals( V object ) {
        return super.equals( object );
    }

}
